//
//  BYMacro.h
//  BYControls
//
//  Created by 彬boy on 2018/11/14.
//  Copyright © 2018年 彬boy. All rights reserved.
//

#ifndef BYMacro_h
#define BYMacro_h

/*! 本地宏*/
#define UserDefaults [NSUserDefaults standardUserDefaults]

/*! 颜色大小定义*/
#define FMRGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define FMRGBAlphaColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:0.4]
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define UIMapColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:0.3]
#define UIFONTSIZE(font) [UIFont systemFontOfSize:font]

//NSLog
#ifdef DEBUG#define NSLog(format, ...) printf("%s:(%d)  method: %s \n%s\n", [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String] )
#else
#define SLog(format, ...)
#endif

//屏幕宽度
#define kScreenW [UIScreen mainScreen].bounds.size.width
//屏幕高度
#define kScreenH [UIScreen mainScreen].bounds.size.height
//屏幕宽度比例
#define kXX  [UIScreen mainScreen].bounds.size.width / 375
//屏幕高度比例
#define kYY  [UIScreen mainScreen].bounds.size.height / (iPhoneX ? 812 : 667)

#define iPhoneX (kScreenH == 812)

#define TabbarHeight (iPhoneX ? 83 : 49)

#define StatusBarHeight  [UIApplication sharedApplication].statusBarFrame.size.height

#define NavigationBarHeight (iPhoneX ? 88 : StatusBarHeight+44)

#define kWindow [[[UIApplication sharedApplication] delegate] window]

#define APPCONFIG_UNIT_LINE_WIDTH                (1/[UIScreen mainScreen].scale)       //常用线宽

#define BY_NormalFontOfSize(fontSize)      [UIFont systemFontOfSize:fontSize]

#endif /* BYMacro_h */
